package com.itheima.list_demo;

import java.util.ArrayList;
import java.util.Arrays;

/*
    Collection接口
        - List接口
            - ArrayList类  : 数组结构
            - LinkedList类 : 链表结构

    构造方法 :
        private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};
        Object[] elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA;


        size = 0

         elementData = Arrays.copyOf(elementData, newCapacity);
         elementData = 长度为10的数组



 */
public class ArrayListDemo {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        int[] newArr = Arrays.copyOf(arr, 10);
        System.out.println(Arrays.toString(newArr));


        ArrayList<String> list = new ArrayList<>();

        // 添加元素
        list.add("Hello");

        list.add("World");

        System.out.println(list);
    }
}
